package br.org.isvi.interpretador.portugol.types;

public class StringSymbol extends SymbolImpl {
	
	public StringSymbol(String value) {
		super(Kind.TEXTO, value);
	}
	
	@Override
	public String toString() {
		return getValue().toString();
	}
	
	public static String replaceSpecialChars(String string) {
		string = string.replaceAll("\\n","\n");
		string = string.replaceAll("\\\\'","'");
		string = string.replaceAll("\\\\\\\\","\\");
		
		return string;
	}
	
	public boolean bigger(Symbol symb) {
		
		String value = symb.getValue().toString();
		
		return this.getValue().toString().length() > value.length();
	}

	public boolean equals(Symbol symb) {

		return this.getValue().equals(symb.getValue());
	}

	public boolean smaller(Symbol symb) {
		String value = symb.getValue().toString();
		
		return this.getValue().toString().length() < value.length();
	}
}
